<template>
  <div class="app-container">

    <YxhyTableData
      :columns="columns"
      :data="tableList"
      :loading="loading"
      :stripe="false"
    >
      <!-- 登录状态插槽 -->
      <template #status>
        <el-table-column label="登录状态" align="center" width="auto">
          <template slot-scope="{ row }">
            <el-tag :type="row.status === 1 ? 'success' : 'danger'">{{ STATUS[row.status] }}</el-tag>
          </template>
        </el-table-column>
      </template>
    </YxhyTableData>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryPage.pageNum"
      :limit.sync="queryPage.limit"
      @pagination="init"
    />

  </div>
</template>

<script>
import { columnsStatic, STATUS } from './Ds.js'
import { queryVideoedList } from '@/api/statistics/videoed'
import { userLoginLog } from '@/api/system/log'

export default {
  name: 'VideoedList',
  data() {
    return {
      // 总条数
      total: 0,
      // 表格数据
      tableList: [],
      // 分页参数
      queryPage: {
        pageNum: 1,
        limit: 10
      },
      // 查询参数
      queryParams: {
        video_id: undefined
      },
      // 查询表单
      queryColumns: [
        {
          label: '',
          placeholder: '请输入小程序名称',
          type: 'selectRemote',
          param: 'video_id'
        }
      ],

      loading: false,
      // 表格列
      columns: columnsStatic,
      STATUS
    }
  },
  computed: {
    isCopyright() {
      return this.$store.state.user.roles.includes('copyright')
    }
  },
  created() {
    this.init()
  },
  methods: {
    async init() {
      this.loading = true
      const res = await userLoginLog({
        ...this.queryPage,
        ...this.queryParams
      })
      this.tableList = res.data
      this.total = res.total
      this.loading = false
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        name: undefined,
        type: 1,
        oss_id: undefined
      }
      this.resetForm('formRef')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryPage.pageNum = 1
      this.init()
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
